<?php
namespace App\Http\Controllers;

use App\Models\Notice;
use Illuminate\Support\Facades\Schema;

class NoticeController extends WxBaseController{
    protected $except=['index','show'];
    public function index($num=10){
        $notices = Notice::simplePaginate($num);
        return $this->apiReturn(true,'success',$notices);
    }
    public function show($id){
        $notice = Notice::where('id','=',$id);
        //更新浏览量
        if(Schema::hasColumn('notices', 'watch')){
            $notice->increment('watch');
        };
        return $this->apiReturn(true,'success',$notice->get());
    }
}